var e = require("../../@babel/runtime/helpers/interopRequireDefault"), t = e(require("../../@babel/runtime/regenerator")), s = require("../../@babel/runtime/helpers/asyncToGenerator"), n = new (e(require("../../http/system")).default)();

Component({
    properties: {
        total: {
            type: Number
        },
        count: {
            type: Number
        },
        money: {
            type: Number
        },
        integralStatus: {
            type: Number,
            optionalTypes: [ null ],
            value: null,
            observer: function(e) {
                this.setData({
                    isUse: e
                });
            }
        }
    },
    data: {
        show: !1,
        rules: "",
        isUse: null
    },
    lifetimes: {
        attached: function() {
            this.getRules();
        }
    },
    methods: {
        getRules: function() {
            var e = this;
            return s(t.default.mark(function s() {
                var r;
                return t.default.wrap(function(t) {
                    for (;;) switch (t.prev = t.next) {
                      case 0:
                        return t.next = 2, n.getSystemConfig("IntegrationUseRule");

                      case 2:
                        r = t.sent, e.setData({
                            rules: r.data.configValue
                        });

                      case 4:
                      case "end":
                        return t.stop();
                    }
                }, s);
            }))();
        },
        change: function(e) {
            this.setData({
                isUse: e.currentTarget.dataset.use
            });
        },
        sureIntegral: function() {
            var e = this.data.isUse;
            0 != e && 1 != e || this.triggerEvent("sendIntegral", {
                isUseIntegral: e
            }), this.onClose();
        },
        onClose: function() {
            this.setData({
                show: !1
            });
        },
        showPopup: function() {
            this.setData({
                show: !0
            });
        },
        showRules: function() {
            this.selectComponent("#rules").showPopup();
        },
        back: function() {
            null == this.properties.integralStatus && this.setData({
                isUse: null
            }), this.onClose();
        }
    }
});